
const getRoutes = (routers) => {
	const list = []
	routers.forEach((x, y) => {

		if( x.parentId === 0){
			// console.log('layout'+x.component)
		}

		list.push({
			...x,
			component: x.parentId === 0 ? () => import(`@/layout${x.component}.vue`) : () => import(`@/views${x.component}.vue`)
		})
		
		if(x.children && x.children.length) {
			list[y].children = getRoutes(x.children)
		}
	})
	return list
}

export default getRoutes
